Conversation
|
after this pr merge , I will update opencli-plugin-gemini-web ,the new opencli-plugin-gemini-web uses streaming API interceptor |
Astro-Han
left a comment
There was a problem hiding this comment.
The streaming interceptor idea is solid — background-tab rAF throttling is a real pain point for AI chat platforms. A few things to address:
Structural
- The plugin link addition and the streaming interceptor are unrelated changes — ideally separate PRs.
package.jsonversion bump (1.5.5 → 1.5.6) should be left to the maintainer.
Testing
- No tests for the new code (
stream-intercept.ts,generateStreamingInterceptorJs,waitForStreamCaptureJs,generateReadStreamJs). The existing test changes only add empty mocks to satisfy the expanded IPage interface.
Functional
- The fetch interceptor resets state (
window.${prefix}_text = '') when a new matching request arrives. If two matching requests overlap, the second silently wipes the first's data. generateReadStreamJsclears all state on read — calling it twice loses data, and there's no option to peek without clearing.
Minor
- English README plugin description uses Chinese (
Web端Gemini交互) — should be English to match the other rows. - Plugin type column shows
—while others useYAMLorTS.
|
Follow-up to my earlier review: there is also some state leakage around the XHR SSE buffer. In But That means if a caller reads early ( I think
There is also a compatibility bug in the SSE parser itself: both the fetch path and XHR path only look for That works for LF-only streams, but a compliant SSE server can also use CRLF line endings. With a stream like So for some perfectly valid SSE responses, |
|
Astro-Han
left a comment
There was a problem hiding this comment.
Thanks for the updates — the tests and peek mode (clear parameter) look solid. Most of my earlier concerns are addressed.
Two small things remaining:
-
PR title still mentions "add plugin link" but those changes are no longer in the diff. Might want to update the title to just the streaming interceptor part.
-
The new
stream-interceptpipeline step has a nice YAML usage example in the code comment, but no corresponding doc page underdocs/. Worth adding if this is intended for adapter authors to use.
Otherwise this looks good to me.
|
Description
feat: add streaming API interceptor for background tab compatibility
Adds streaming-capable network interception that works in background
browser tabs where requestAnimationFrame is throttled. This enables
capturing streaming API responses (e.g., Gemini's StreamGenerate XHR)
without relying on DOM rendering.
Key changes:
onprogress/readystatechange dual capture
waitForStreamCapture methods
to guarantee data completeness
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com
Related issue:
Type of Change
Checklist
Documentation (if adding/modifying an adapter)
docs/adapters/(if new adapter)docs/adapters/index.mdtable (if new adapter)docs/.vitepress/config.mts(if new adapter)README.md/README.zh-CN.mdwhen command discoverability changedCliErrorsubclasses instead of rawErrorScreenshots / Output